Install packages if necessary. Listed are installers for packages not on CRAN and the devlopment (most up-to-date) version of STEPS.
# library(devtools)
# install_github("steps-dev/steps")
# install_github("smwindecker/gdaltools")
Load packages
library(raster)
Loading required package: sp
library(dplyr)
Attaching package: ‘dplyr’
The following objects are masked from ‘package:raster’:
intersect, select, union
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
library(tibble)
library(sf)
Linking to GEOS 3.6.2, GDAL 2.2.3, PROJ 4.9.3
library(rgdal)
rgdal: version: 1.4-3, (SVN revision 828)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 2.2.3, released 2017/11/20
Path to GDAL shared files: /usr/share/gdal/2.2
GDAL binary built with GEOS: TRUE
Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
Path to PROJ.4 shared files: (autodetected)
Linking to sp version: 1.3-1
library(readr)
library(readxl)
library(ggplot2)
library(lubridate)
Attaching package: ‘lubridate’
The following object is masked from ‘package:base’:
date
library(magrittr)
Attaching package: ‘magrittr’
The following object is masked from ‘package:raster’:
extract
library(tidyr)
Attaching package: ‘tidyr’
The following object is masked from ‘package:magrittr’:
extract
The following object is masked from ‘package:raster’:
extract
library(foreach)
library(doMC)
Loading required package: iterators
Loading required package: parallel
library(future)
Attaching package: ‘future’
The following object is masked from ‘package:raster’:
values
library(future.apply)
library(tidyr)
library(dismo)
library(gbm)
Loaded gbm 2.1.5
library(steps)
library(gdaltools)
source(file = "R/functions/pg.sf.R")
source(file = "R/functions/pg.pa.R")
source(file = "R/functions/read.vba.R")
source(file = "R/functions/proc.vba.R")
source(file = "R/functions/get.landis.vars.R")
source(file = "R/functions/rascc.R")
source(file = "R/functions/read.multi.line.header.R")
source(file = "R/functions/interpolate.climdat.R")
source(file = "R/functions/get.rst.prop.R")
source(file = "R/functions/get.rst.dat.R")
proj_path <- "/home/landis/rfst/"
# proj_path <- "D:/Users/ryan/Dropbox/Work/RFA_STEPS/rfst/"
ntimesteps <- 50
ncores <- 20
Set up base landscape layer
ch_rst <- raster(x = "data/grids/eco_v12.img") %T>%
plot
ch_proj <- ch_rst@crs
ch_extent <- extent(ch_rst)
ch_res <- res(ch_rst)
rfa <- read_sf("data/shapefiles/RFA/")%>%
st_transform(crs = ch_proj)
rfa
Simple feature collection with 81 features and 7 fields
geometry type: POLYGON
dimension: XY
bbox: xmin: -57985.97 ymin: 5665387 xmax: 763088.7 ymax: 6223446
epsg (SRID): NA
proj4string: +proj=utm +zone=55 +south +ellps=GRS80 +towgs84=0,0,0,-0,-0,-0,0 +units=m +no_defs